package com.flower.subject.application.controller;

import com.flower.subject.application.convert.SubjectLikeDTOConverter;
import com.flower.subject.application.dto.SubjectLikedDTO;
import com.flower.subject.domain.entity.SubjectLabelBO;
import com.flower.subject.domain.entity.SubjectLikedBO;
import com.flower.subject.domain.service.SubjectLikedDomainService;
import com.flower.subject.entity.Result;
import com.flower.subject.infra.basic.entity.SubjectLiked;
import com.flower.subject.infra.basic.service.SubjectLikedService;
import com.flower.subject.utils.LoginUtil;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (SubjectLiked)表控制层
 *
 * @author makejava
 * @since 2024-07-28 22:04:11
 */
@RestController
@RequestMapping("subjectLiked")
public class SubjectLikedController {
    /**
     * 服务对象
     */
    @Resource
    private SubjectLikedDomainService subjectLikedDomainService;



    @PostMapping ("add")
    public Result<Boolean> add(@RequestBody SubjectLikedDTO subjectLikedDTO) {

        String loginId = LoginUtil.getLoginId();
        subjectLikedDTO.setLikeUserId(Long.valueOf(loginId));
        SubjectLikedBO subjectLikedBO = SubjectLikeDTOConverter.INSTANT.convertBoTOLabel(subjectLikedDTO);

        subjectLikedDomainService.add(subjectLikedBO);
        return Result.ok();
    }



}

